<template>
	<view style="background-color: #333333;height: 100%;">
		<!-- <u-navbar :title="title"></u-navbar> -->
		<u-navbar :title="$t('base.f20')"></u-navbar>
		<!-- 		<view id="top_div">
			<view>
				<text>{{$t('base.f1')}}</text>
			</view>
			<view>
				<view id="money_total_div">
					<text id="total_amount">{{totalAmount}}</text>
					<text style="font-size: 24rpx;">USDT</text>
				</view>
			</view>
			<view id="top_btm_3_div">
				<view class="top_btm_item_div">
					<text class="color_gray">{{$t('base.f2')}}</text>
					<text>{{day_rate}}%</text>
				</view>
				<view class="top_btm_item_div">
					<text class="color_gray">{{$t('base.f3')}}</text>
					<text>{{total_interest}}</text>
				</view>
				<view class="top_btm_item_div">
					<text class="color_gray">{{$t('base.f5')}}</text>
					<text>{{orderCount}}</text>
				</view>
			</view>
			<view id="btn_weituo" @click="$utils.jump('/pages/lockming/order')">
				<text>{{$t('base.f6')}}</text>
			</view>
		</view> -->
		<view id="wk_list_div">
			<view class="wk_item_div" v-for="item in list">
				<view style="display: flex;justify-content: space-between;">
					<text>质押币种 {{item.coin_name}}</text>
					<text class="btn_suocang" @click="jump(item)">{{$t('base.f13')}}</text>
				</view>
				<view class="wk_item_btm_div">
					<view class="wk_item_btm_item_div">
						<text class="color_gray">{{$t('base.f21')}}</text>
						<text>{{parseFloat(item.amount)}}</text>
					</view>
					<view class="wk_item_btm_item_div">
						<text class="color_gray">{{$t('base.f22')}}</text>
						<text>{{parseFloat(item.annualized_rate)}}%</text>
					</view>
					<view class="wk_item_btm_item_div">
						<text class="color_gray">{{$t('base.f23')}}</text>
						<!-- <text>{{item.day}}({{$t('base.f12')}})</text> -->
						<text>{{item.cycle}}</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import config from '../../app.js'
	import Wk from "@/api/a_wk";
	export default {
		data() {
			return {
				// 矿机详情对象
				// {
				// 	"id": 17,
				// 	"kuang_id": 1,
				// 	"coin_id": 1,
				// 	"coink_id": 1,
				// 	"cycle": 30,
				// 	"amount": "10.0000",
				// 	"annualized_rate": "1.0000",
				// 	"status": 0,
				// 	"created_at": "2021-11-25 14:47:00",
				// 	"updated_at": "2024-06-02 22:16:02",
				// 	"coin_name": "USDT"
				// }
				list: [],
				totalAmount: 0, //正在托管的资金
				orderCount: 0, //托管中的订单,
				day_rate: 0, //日收益率
				total_interest: 0, //累计收益
			}
		},

		onLoad(options) {
			const id = options.id
			// console.log('id = ', id);
			if (id) {
				this.getWkDetail(id)
			}
		},

		mounted() {
			// const project = uni.getStorageSync('lockming') || {}
			// 清除storage
			// uni.removeStorageSync('lockming')
			// console.log('project = ', project);

		},

		methods: {
			jump(item) {
				uni.setStorageSync('lock', item)
				uni.navigateTo({ url: '/pages/a_wk/wk_lock' })
			},
			getWkDetail(id) {
				Wk.getMachineDetail({ id }).then(res => {
					// console.log('getMachineDetail.res.data = ', res.data);
					this.list = res.data
				});
			},
		},
	}
</script>

<style lang="scss" scoped>
	.color_gray {
		color: #A6A6A6;
		margin: 0 0 4rpx 0;
	}

	#top_div {
		position: relative;
		display: flex;
		flex-direction: column;
		background-color: #FFE3C1;
		margin: 24rpx;
		padding: 24rpx;
		border-radius: 24rpx;
	}

	#money_total_div {
		margin: 24rpx 0 0 0;
	}

	#total_amount {
		font-size: 44rpx;
		margin: 0 24rpx 0 0;
	}

	#top_btm_3_div {
		display: flex;
		justify-content: space-between;
		margin: 48rpx 0 0 0;
	}

	.top_btm_item_div {
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	#btn_weituo {
		position: fixed;
		right: 48rpx;
		font-size: 24rpx;
		color: #D3DCC2;
		background-color: #604D29;
		padding: 10rpx 20rpx;
		border-radius: 8rpx;
	}

	#wk_list_div {
		color: white;
		margin: 24rpx;
	}

	.wk_item_div {
		display: flex;
		flex-direction: column;
		background-color: #4D4D4D;
		margin: 24rpx 0 0 0;
		padding: 24rpx;
		border-radius: 24rpx;
	}

	.btn_suocang {
		background-color: #FFDDB3;
		padding: 6rpx 24rpx;
		border-radius: 8rpx;
		font-size: 24rpx;
	}

	.wk_item_btm_div {
		display: flex;
		justify-content: space-between;
		margin: 24rpx 0 0 0;
	}

	.wk_item_btm_item_div {
		display: flex;
		flex-direction: column;
		align-items: center;
	}
</style>